/**
 * Dear programmer:
 * When I wrote this code, only god and I knew how it worked.
 * Now, only god knows it!
 *
 * @author: swx  Date: 2019/09/10 Time: 16:03
 *
 * 客房清洁
 */

import React, {Component} from 'react';
import {
    View,
    Text,
    TouchableOpacity,
    TouchableHighlight, ScrollView, SafeAreaView, Modal, ToastAndroid, FlatList
} from 'react-native';
import {connect} from 'react-redux';
import {styles} from './WorkOrderListScreen.Style';
import {} from "./Actions";
import {FetchStatus} from "../../../configuration/RequestConfiguration";
import {ReturnStatus} from "../../../configuration/ReturnStatus";
import {doDisplayWarnMessage} from "../../../component/Message/Action";
import ScrollableTabView, { DefaultTabBar,ScrollableTabBar } from 'react-native-scrollable-tab-view';
import {getDs,getDs_R} from "../../job/WorkOrder/DepartmentalRepairOrderScreen/Actions";
import AntDesign from "react-native-vector-icons/AntDesign";
import {COLOR_FOCUS, COLOR_LINK, COLOR_THEME, COLOR_WHITE, FONT_COLOR_SUB_TITLE} from "../../../constant/PHColors";
import DividingLineViewComponent from "../../../component/DividingLineViewComponent/DividingLineViewComponent";
import MaterialCommunityIcons from "react-native-vector-icons/MaterialCommunityIcons";
import FontAwesome5 from "react-native-vector-icons/FontAwesome5"
import User from "../../../model/User/User";

class WorkOrderListScreen extends Component {

    static navigationOptions = ({navigation}) => ({
        headerTitle: `即时工单`,
    });

    // 构造
    constructor(props) {
        super(props);
        // 初始状态
        this.state = {//E代表工程  R代表房务
            userid:'',

            defaultMsg_E:[],
            selectValue_E:{"status":"","role":"","area":"","work_userid":""},
            showFoot_E:0, // 控制foot， 0：隐藏footer  1：已加载完成,没有更多数据   2 ：显示加载中
            pageNo_E: 1,//当前第几页
            totalPage_E:0,//总的页数
            recordNum_E:0,//数据总条数
            selectModal_E:false,
            selectModalValue_E:"处理中",
            refreshing_E:false,//下拉刷新

            defaultMsg_R:[],
            selectValue_R:{"status":"","role":"","area":"","work_userid":""},
            showFoot_R:0, // 控制foot， 0：隐藏footer  1：已加载完成,没有更多数据   2 ：显示加载中
            pageNo_R: 1,//当前第几页
            totalPage_R:0,//总的页数
            recordNum_R:0,//数据总条数
            selectModal_R:false,
            selectModalValue_R:[],
            refreshing_R:false,//下拉刷新
        };
    }

    componentWillReceiveProps(nextProps, nextContext): void {
        let {dispatch} = this.props;

        if (nextProps.onGetDs !== this.props.onGetDs && nextProps.onGetDs.fetchStatus === FetchStatus.Success) {
            let defaultInfo = nextProps.onGetDs.rows;
            this.state.showFoot_E = 0;
            if(this.state.pageNo_E>=nextProps.onGetDs.total){
                this.state.showFoot_E = 1;//listView底部显示没有更多数据了
            }
            if(this.state.pageNo_E===1){
                defaultInfo = nextProps.onGetDs.rows
            }else{
                defaultInfo = this.state.defaultMsg_E.concat(defaultInfo)
            }
            this.setState({
                defaultMsg_E: defaultInfo,
                totalPage_E:nextProps.onGetDs.total,
                recordNum_E:nextProps.onGetDs.records,
                refreshing_E:false,
            });

        }



        if (nextProps.onGetDs_R !== this.props.onGetDs_R && nextProps.onGetDs_R.fetchStatus === FetchStatus.Success) {
            // let defaultInfo = nextProps.onGetDs_R.rows;
            //
            // this.state.showFoot_R = 0;
            // if(this.state.pageNo_R>=nextProps.onGetDs_R.total){
            //     this.state.showFoot_R = 1;//listView底部显示没有更多数据了
            // }
            // if(this.state.pageNo_R===1){
            //     defaultInfo = nextProps.onGetDs_R.rows
            // }else{code-push release-react HSHotel_1.0 android  --t 1.0.0 --dev false --d Staging --des "发布测试版本" --m true
            //     defaultInfo = this.state.defaultMsg_R.concat(defaultInfo)
            // }
            // let totalPage_R = nextProps.onGetDs_R.total;
            // let recordNum_R = nextProps.onGetDs_R.records;
            let defaultInfo = nextProps.onGetDs_R.immediately;
            let totalPage_R = defaultInfo.length;
            let recordNum_R = defaultInfo.length;
            this.state.showFoot_R = 1;
            this.setState({
                defaultMsg_R: defaultInfo,
                totalPage_R:totalPage_R,
                recordNum_R:recordNum_R,
                refreshing_R:false,
            });
        }

    }

    // 组件渲染后调用
    componentDidMount() {
        this.setState({
            pageNo_R:1,
            pageNo_E:1,
        });
        // this.props.navigation.navigate('MainNavigator');



        User.getUser(user => {
            this.state.userid = user.userid;
            this.state.selectValue_E.status = this.state.selectModalValue_E;
            this.state.selectValue_E.work_userid = user.userid;
            let {dispatch} = this.props;
            let str = {"arg":{"SQLfields":"sn,status,object_name,type,recordno,area_fullname,object_fullname,create_datetime,report_username,report_connect,remark"},"where":this.state.selectValue_E};

            dispatch(getDs(JSON.stringify(str),this.state.pageNo_E));

            let str_R = {"arg":{"wuserid":user.userid}}
            dispatch(getDs_R(JSON.stringify(str_R),this.state.pageNo_E));
        })

    }

    render() {
        let {dispatch} = this.props;
        return (

            <SafeAreaView style={styles.container}>
                {
                    (this.state.defaultMsg_R.length>0||this.state.defaultMsg_E.length>0)
                    &&
                    (
                        <ScrollableTabView
                            tabBarUnderlineColor="#4DC5FF"
                            tabBarTextStyle={{
                                fontSize: 18
                            }}
                            tabBarUnderlineStyle={{backgroundColor: '#4C70FF'}}
                            tabBarActiveTextColor="#4C70FF"
                            renderTabBar={() => <DefaultTabBar/>}
                            onChangeTab={(_this)=>{
                                console.log(_this.ref.props.tabLabel)
                            }}
                        >

                            {
                                (this.state.defaultMsg_R.length>0)
                                &&
                                (
                                    <View tabLabel='房务' style={styles.container} >
                                        <SafeAreaView style={styles.container}>
                                            <View style={styles.body}>
                                                <View style={styles.headerContainer}>
                                                    <View style={{flexDirection:'row',}}>
                                                        <Text style={styles.headerText}>
                                                            共{this.state.recordNum_R?this.state.recordNum_R:'0'}张单
                                                        </Text>
                                                    </View>
                                                    <View style={{flexDirection:'row',}}>
                                                        <TouchableOpacity activeOpacity={0.9} onPress={()=>{
                                                            this.setState({
                                                                selectModal_R:!this.state.selectModal_R
                                                            })
                                                        }}>
                                                            <View style={{right:10,flexDirection: 'row'}}>
                                                                <Text style={{fontSize: 16, color: COLOR_LINK}}>
                                                                    <FontAwesome5 name={'search'} size={15} style={{marginRight: 5}}/>
                                                                    查看工单类型
                                                                </Text>
                                                            </View>
                                                        </TouchableOpacity>
                                                    </View>
                                                </View>
                                                <FlatList
                                                    data = {this.state.defaultMsg_R}
                                                    onRefresh = {this._onRefresh_R.bind(this)} //刷新操作
                                                    refreshing = {this.state.refreshing_R}
                                                    renderItem={this._renderItem_R}
                                                    ListFooterComponent={this._renderFooter_R.bind(this)}
                                                    onEndReachedThreshold={0.1}
                                                    keyExtractor={(item, index) => index.toString()}
                                                    onEndReached={this._onEndReached_R.bind(this)}
                                                />
                                            </View>
                                        </SafeAreaView>
                                    </View>
                                )
                            }

                            {
                                (this.state.defaultMsg_E.length>0)
                                &&
                                (
                                    <View tabLabel='工程' style={styles.container} >
                                        <SafeAreaView style={styles.container}>
                                            <View style={styles.body}>
                                                <View style={styles.headerContainer}>
                                                    <Text style={styles.headerText}>
                                                        共{this.state.recordNum_E?this.state.recordNum_E:'0'}张单
                                                    </Text>
                                                    {/*<TouchableOpacity activeOpacity={0.9} onPress={()=>{*/}
                                                        {/*this.setState({*/}
                                                            {/*selectModal_E:!this.state.selectModal_E*/}
                                                        {/*})*/}
                                                    {/*}}>*/}
                                                        {/*<View style={{right:10,flexDirection: 'row'}}>*/}
                                                            {/*<Text style={{fontSize: 16, color: FONT_COLOR_SUB_TITLE}}>*/}
                                                                {/*状态：*/}
                                                            {/*</Text>*/}
                                                            {/*<Text style={{fontSize: 16, color: COLOR_LINK}}>*/}
                                                                {/*{this.state.selectModalValue_E}*/}
                                                                {/*/!*<AntDesign name={'down'} size={15} style={{color: FONT_COLOR_SUB_TITLE,marginLeft: 5}}/>*!/*/}
                                                            {/*</Text>*/}
                                                        {/*</View>*/}
                                                    {/*</TouchableOpacity>*/}
                                                </View>
                                                <FlatList
                                                    data = {this.state.defaultMsg_E}
                                                    onRefresh = {this._onRefresh_E.bind(this)} //刷新操作
                                                    refreshing = {this.state.refreshing_E}
                                                    renderItem={this._renderItem_E}
                                                    ListFooterComponent={this._renderFooter_E.bind(this)}
                                                    onEndReachedThreshold={0.1}
                                                    keyExtractor={(item, index) => index.toString()}
                                                    onEndReached={this._onEndReached_E.bind(this)}
                                                />
                                            </View>
                                        </SafeAreaView>
                                    </View>
                                )
                            }

                        </ScrollableTabView>
                    )
                }

                {
                    (this.state.defaultMsg_R.length===0&&this.state.defaultMsg_E.length===0)
                    &&
                    (
                        <View  style={styles.windowCenter}>
                            <Text style={styles.headerText}>
                                暂无工单
                            </Text>
                        </View>
                    )
                }


                <Modal onRequestClose={()=> this._onRequestClose()} transparent={true} visible={this.state.selectModal_E}>
                    <TouchableOpacity style={{flex: 1}} activeOpacity={1} onPress={()=> this._onRequestClose()}>
                        <View style={styles.modalContainer}>
                            <View style={styles.modalView}>
                                <View style={styles.modalHeader}>
                                    <Text style={styles.modalHeaderText}>
                                        工单状态
                                    </Text>
                                </View>

                                <TouchableOpacity style={styles.modalItemView} activeOpacity={0.8} onPress={() => {
                                    this._onRequestClose()
                                    this._setSelectModalValue_E("所有状态");
                                }}>
                                    <View style={styles.modalItemViewLeft}>
                                        <Text style={styles.modalItemText}>
                                            所有状态
                                        </Text>
                                    </View>
                                    {this._selectModalValue_E("所有状态")}
                                </TouchableOpacity>

                                <DividingLineViewComponent lineHeight={1}/>

                                <TouchableOpacity style={styles.modalItemView} activeOpacity={0.8} onPress={() => {
                                    this._onRequestClose()
                                    this._setSelectModalValue_E("处理中");
                                }}>
                                    <View style={styles.modalItemViewLeft}>
                                        <Text style={styles.modalItemText}>
                                            处理中
                                        </Text>
                                    </View>
                                    {this._selectModalValue_E("处理中")}
                                </TouchableOpacity>

                                <DividingLineViewComponent lineHeight={1}/>

                                <TouchableOpacity style={styles.modalItemView} activeOpacity={0.8} onPress={() => {
                                    this._onRequestClose()
                                    this._setSelectModalValue_E("待验收");
                                }}>
                                    <View style={styles.modalItemViewLeft}>
                                        <Text style={styles.modalItemText}>
                                            待验收
                                        </Text>
                                    </View>
                                    {this._selectModalValue_E("待验收")}
                                </TouchableOpacity>

                                <DividingLineViewComponent lineHeight={1}/>

                                <TouchableOpacity style={styles.modalItemView} activeOpacity={0.8} onPress={() => {
                                    this._onRequestClose()
                                    this._setSelectModalValue_E("完成");
                                }}>
                                    <View style={styles.modalItemViewLeft}>
                                        <Text style={styles.modalItemText}>
                                            完成
                                        </Text>
                                    </View>
                                    {this._selectModalValue_E("完成")}
                                </TouchableOpacity>

                                <DividingLineViewComponent lineHeight={1}/>

                                <TouchableOpacity style={styles.modalBottomView} activeOpacity={0.8} onPress={() => {
                                    this._onRequestClose()
                                }}>
                                    <View style={styles.modalBottomView}>
                                        <Text style={styles.modalBottomText}>
                                            返回
                                        </Text>
                                    </View>
                                </TouchableOpacity>
                            </View>
                        </View>
                    </TouchableOpacity>
                </Modal>

                <Modal onRequestClose={()=> this._onRequestClose()} transparent={true} visible={this.state.selectModal_R}>
                    <TouchableOpacity style={{flex: 1}} activeOpacity={1} onPress={()=> this._onRequestClose()}>
                        <View style={styles.modalContainer}>
                            <View style={styles.modalView}>
                                <View style={styles.modalHeader}>
                                    <Text style={styles.modalHeaderText}>
                                        工单类型
                                    </Text>
                                </View>

                                {
                                    this.roomOrderType()
                                }

                                <TouchableOpacity style={styles.modalBottomView} activeOpacity={0.8} onPress={() => {
                                    this._onRequestClose()
                                }}>
                                    <View style={styles.modalBottomView}>
                                        <Text style={styles.modalBottomText}>
                                            返回
                                        </Text>
                                    </View>
                                </TouchableOpacity>
                            </View>
                        </View>
                    </TouchableOpacity>
                </Modal>

            </SafeAreaView>
        )
    };

    roomOrderType(){
        let _this = this;
        let type_arr = [];
        let html_arr = [];

        let defaultSelect = ["待完成","待检查","完成"]
        defaultSelect.map((item,index)=> {
            let html = (
                <TouchableOpacity style={styles.modalItemView} activeOpacity={0.8} onPress={() => {
                    let selectModalValue_R = _this.state.selectModalValue_R;
                    if(selectModalValue_R.indexOf(item)>=0){
                        selectModalValue_R.splice(selectModalValue_R.indexOf(item),1)
                    }else{
                        selectModalValue_R.push(item)
                    }
                    _this.setState({selectModalValue_R:selectModalValue_R})
                }}>
                    <View style={styles.modalItemViewLeft}>
                        <Text style={styles.modalItemText}>
                            {item}
                        </Text>
                    </View>
                    {
                        (this.state.selectModalValue_R.indexOf(item)>=0)?(
                            <View style={[styles.modalItemViewRight,{justifyContent: 'center',color:COLOR_FOCUS}]}>
                                <MaterialCommunityIcons name={'checkbox-intermediate'} size={25} />
                            </View>
                        ):(
                            <View style={[styles.modalItemViewRight,{justifyContent: 'center',color:COLOR_FOCUS}]}>
                                <MaterialCommunityIcons name={'checkbox-blank-outline'} size={25} />
                            </View>
                        )
                    }
                    {/*{this._selectModalValue_R(item.ordertype)}*/}
                </TouchableOpacity>
            );
            let underline = (<DividingLineViewComponent lineHeight={1}/>);

            if(type_arr.indexOf(item)<0){
                type_arr.push(item);
                html_arr.push(html);
                html_arr.push(underline);
            }
        })

        this.state.defaultMsg_R.map((item,index)=> {
            let html = (
                <TouchableOpacity style={styles.modalItemView} activeOpacity={0.8} onPress={() => {
                    let selectModalValue_R = _this.state.selectModalValue_R;
                    if(selectModalValue_R.indexOf(item.ordertype)>=0){
                        selectModalValue_R.splice(selectModalValue_R.indexOf(item.ordertype),1)
                    }else{
                        selectModalValue_R.push(item.ordertype)
                    }
                    _this.setState({selectModalValue_R:selectModalValue_R})
                }}>
                    <View style={styles.modalItemViewLeft}>
                        <Text style={styles.modalItemText}>
                            {item.ordertype}
                        </Text>
                    </View>
                    {
                        (this.state.selectModalValue_R.indexOf(item.ordertype)>=0)?(
                            <View style={[styles.modalItemViewRight,{justifyContent: 'center',color:COLOR_FOCUS}]}>
                                <MaterialCommunityIcons name={'checkbox-intermediate'} size={25} />
                            </View>
                        ):(
                            <View style={[styles.modalItemViewRight,{justifyContent: 'center',color:COLOR_FOCUS}]}>
                                <MaterialCommunityIcons name={'checkbox-blank-outline'} size={25} />
                            </View>
                        )
                    }
                    {/*{this._selectModalValue_R(item.ordertype)}*/}
                </TouchableOpacity>
            );
            let underline = (<DividingLineViewComponent lineHeight={1}/>);

            if(type_arr.indexOf(item.ordertype)<0){
                type_arr.push(item.ordertype);
                html_arr.push(html);
                html_arr.push(underline);
            }
        })

        return html_arr
    }

    _onRequestClose(){
        this.setState({
            selectModal_E:false,
            selectModal_R:false
        })
    }

    //下拉刷新,更改状态，重新获取数据
    _onRefresh_E(){
        this.setState({
            refreshing_E:true,
            defaultMsg_E:[]
        },()=>{
            this.state.pageNo_E=1;
            let {dispatch} = this.props;
            let str = {"arg":{"SQLfields":"sn,status,object_name,type,recordno,area_fullname,object_fullname,create_datetime,report_username,report_connect,remark"},"where":this.state.selectValue_E};
            dispatch(getDs(JSON.stringify(str),this.state.pageNo_E))
        });
    }

    _onRefresh_R(){
        this.setState({
            refreshing_R:true,
            defaultMsg_R:[]
        },()=>{
            this.state.pageNo_R=1;
            let {dispatch} = this.props;
            // let str = {"arg":{"SQLfields":"sn,status,object_name,type,recordno,area_fullname,object_fullname,create_datetime,report_username,report_connect,remark"},"where":this.state.selectValue_R};
            // dispatch(getDs(JSON.stringify(str),this.state.pageNo_R))
            User.getUser(user => {
                let str_R = {"arg":{"wuserid":user.userid}}
                dispatch(getDs_R(JSON.stringify(str_R),this.state.pageNo_E));
            })
        });
    }

    //列表内容循环
    _renderItem_E = ({ item }) => {
        let _this=this;
        return (
            <TouchableOpacity activeOpacity={0.8} onPress={() => {
                this.props.navigation.navigate('DepartmentalRepairOrderDetailScreen',{"sn":item.sn,"beforePage":"ImmediateOrderScreen",callBack:()=>{
                        let {dispatch} = _this.props;
                        let str = {"arg":{"SQLfields":"sn,status,object_name,type,recordno,area_fullname,object_fullname,create_datetime,report_username,report_connect,remark"},"where":_this.state.selectValue_E};
                        dispatch(getDs(JSON.stringify(str),_this.state.pageNo_E))
                    }})
            }}>
                <View style={styles.boxBody} onPress={()=>{

                }}>
                    <View style={styles.top}>
                        <View style={styles.topLeft}>
                            <Text style={styles.topPointText}>
                                {item.object_fullname ? (item.object_fullname.length > 10 ? item.object_fullname.substr(0, 10) + "..." : item.object_fullname) : ""}
                            </Text>
                        </View>
                        <View style={styles.topRight}>
                            {item.type==="紧急维修"?<Text style={styles.topFromTextRed}>{item.type}</Text>:<Text style={styles.topFromTextBlue}>{item.type}</Text>}
                        </View>
                    </View>

                    <View style={styles.center}>
                        <Text style={styles.centerText}>
                            {item.area_fullname ? (item.area_fullname.length > 17 ? item.area_fullname.substr(0, 17) + "..." : item.area_fullname) : ""}
                        </Text>
                    </View>

                    <View style={styles.bottom}>
                        <Text style={styles.bottomText}>
                            {item.create_datetime}
                        </Text>
                    </View>
                </View>
            </TouchableOpacity>
        )
    };

    _renderItem_R = ({ item }) => {
        let _this=this;

        let whsk_status = item.status
        if(item.status1!==""){
            whsk_status = item.status1
        }else{
            whsk_status = item.status
        }
        console.log(JSON.stringify(item))

        if(this.state.selectModalValue_R.indexOf(item.ordertype)>=0 || this.state.selectModalValue_R.length===0 || this.state.selectModalValue_R.indexOf(whsk_status)>=0 ){
            return (
                <TouchableOpacity activeOpacity={0.8} onPress={() => {
                    let authority = '检查人'
                    this.props.navigation.navigate('RoomStatusScreen',{room:item.room,button:'yes',authority:authority,orderid:item.orderid,callBack:()=>{
                            let {dispatch} = _this.props;
                            // let str = {"arg":{"SQLfields":"sn,status,object_name,type,recordno,area_fullname,object_fullname,create_datetime,report_username,report_connect,remark"},"where":_this.state.selectValue_R};
                            // dispatch(getDs(JSON.stringify(str),_this.state.pageNo_R))
                            User.getUser(user => {
                                let str_R = {"arg":{"wuserid":user.userid}}
                                dispatch(getDs_R(JSON.stringify(str_R),this.state.pageNo_E));
                            })
                        }})
                }}>
                    <View style={styles.boxBody} onPress={()=>{

                    }}>
                        <View style={styles.top}>
                            <View style={styles.topLeft}>
                                <Text style={styles.topPointText}>
                                    {item.ordertype ? (item.ordertype.length > 10 ? item.ordertype.substr(0, 10) + "..." : item.ordertype) : ""}
                                </Text>
                            </View>
                            <View style={styles.topRight}>
                                {whsk_status?<Text style={styles.topFromTextBlue}>{whsk_status}</Text>:<Text style={styles.topFromTextWhite}>{whsk_status}</Text>}
                            </View>
                        </View>

                        <View style={styles.center}>
                            <Text style={styles.centerText}>
                                {item.room ? (item.room.length > 17 ? item.room.substr(0, 17) + "..." : item.room) : ""}
                            </Text>
                        </View>

                        <View style={styles.bottom}>
                            <Text style={styles.bottomText}>
                                {item.crdate}
                            </Text>
                        </View>
                    </View>
                </TouchableOpacity>
            )
        }
    };

    _onEndReached_E(){
        //如果是正在加载中或没有更多数据了，则返回
        if(this.state.showFoot_E !== 0 ){
            return ;
        }
        //如果当前页大于或等于总页数，那就是到最后一页了，返回
        if((this.state.pageNo_E!==1) && (this.state.pageNo_E>=this.state.totalPage_E)){
            return;
        } else {
            this.state.pageNo_E++;
        }
        //底部显示正在加载更多数据
        this.state.showFoot_E=2;

        //获取数据
        if(this.state.selectModalValue_E==="所有状态"){
            this.state.selectValue_E.status = "";
        }else{
            this.state.selectValue_E.status = this.state.selectModalValue_E;
        }
        this.state.selectValue_E.work_userid = this.state.userid;
        let {dispatch} = this.props;
        let str = {"arg":{"SQLfields":"sn,status,object_name,type,recordno,area_fullname,object_fullname,create_datetime,report_username,report_connect,remark"},"where":this.state.selectValue_E};
        dispatch(getDs(JSON.stringify(str),this.state.pageNo_E))
    }

    _onEndReached_R(){
        //如果是正在加载中或没有更多数据了，则返回
        if(this.state.showFoot_R !== 0 ){
            return ;
        }
        //如果当前页大于或等于总页数，那就是到最后一页了，返回
        if((this.state.pageNo_R!==1) && (this.state.pageNo_R>=this.state.totalPage_R)){
            return;
        } else {
            this.state.pageNo_R++;
        }
        //底部显示正在加载更多数据
        this.state.showFoot_R=2;

        //获取数据
        this.state.selectValue_R.work_userid = this.state.userid;
        let {dispatch} = this.props;
        // let str = {"arg":{"SQLfields":"sn,status,object_name,type,recordno,area_fullname,object_fullname,create_datetime,report_username,report_connect,remark"},"where":this.state.selectValue_R};
        // dispatch(getDs(JSON.stringify(str),this.state.pageNo_R))
        User.getUser(user => {
            let str_R = {"arg":{"wuserid":user.userid}}
            dispatch(getDs_R(JSON.stringify(str_R),this.state.pageNo_E));
        })

    }

    _renderFooter_E(){
        if (this.state.showFoot_E === 1) {
            return (
                <View style={{height:30,alignItems:'center',justifyContent:'flex-start',}}>
                    <Text style={{color:'#999999',fontSize:14,marginTop:5,marginBottom:5,}}>
                        没有更多数据了
                    </Text>
                </View>
            );
        } else if(this.state.showFoot_E === 2) {
            return (
                <View style={styles.footer}>
                    {/*<ActivityIndicator />*/}
                    <Text>正在加载更多数据...</Text>
                </View>
            );
        } else if(this.state.showFoot_E === 0){
            return (
                <View style={styles.footer}>
                    <Text>

                    </Text>
                </View>
            );
        }
    }

    _renderFooter_R(){
        if (this.state.showFoot_R === 1) {
            return (
                <View style={{height:30,alignItems:'center',justifyContent:'flex-start',}}>
                    <Text style={{color:'#999999',fontSize:14,marginTop:5,marginBottom:5,}}>
                        没有更多数据了
                    </Text>
                </View>
            );
        } else if(this.state.showFoot_R === 2) {
            return (
                <View style={styles.footer}>
                    {/*<ActivityIndicator />*/}
                    <Text>正在加载更多数据...</Text>
                </View>
            );
        } else if(this.state.showFoot_R === 0){
            return (
                <View style={styles.footer}>
                    <Text>

                    </Text>
                </View>
            );
        }
    }

    _setSelectModalValue_E = (value) =>{
        this.setState({selectModalValue_E:value,pageNo_E:1,});
        this.props.navigation.setParams({selectModalValue_E:value});

        //获取数据
        if(value==="所有状态"){
            this.state.selectValue_E.status = "";
        }else{
            this.state.selectValue_E.status = value;
        }
        this.state.selectValue_E.work_userid = this.state.userid;
        this.state.pageNo_E = 1;
        let {dispatch} = this.props;
        let str = {"arg":{"SQLfields":"sn,status,object_name,type,recordno,area_fullname,object_fullname,create_datetime,report_username,report_connect,remark"},"where":this.state.selectValue_E};
        dispatch(getDs(JSON.stringify(str),this.state.pageNo_E))
    }

    _selectModalValue_E = (value) => {
        if(this.state.selectModalValue_E===value){
            return(
                <View style={styles.modalItemViewRight}>
                    <MaterialCommunityIcons name={'radiobox-marked'} size={25} />
                </View>
            )
        }else{
            return(
                <View style={styles.modalItemViewRight}>
                    <MaterialCommunityIcons name={'radiobox-blank'} size={25} />
                </View>
            )
        }
    };
}


const props = state => {
    return {
        onGetDs: state.onGetDs,
        onGetDs_R: state.onGetDs_R,
        onLogin: state.onLogin
    }
};

export default WorkOrderListScreen = connect(props)(WorkOrderListScreen);
